<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class ModelField extends MY_AdminModel
{
    function __construct()
    {
        parent::__construct();
        $this->load->database();
        $this->load->library('session');
    }

    public function get($ID=null,$tableID=null,$active=null,$delete=null){
        $condition = array();
        if($ID!==null){
            $condition[$this->map->field()->ID]=$ID;
        }
        if($tableID!==null){
            $condition[$this->map->field()->TableID]=$tableID;
        }
        if($active!==null){
            $condition[$this->map->field()->Activated]=$active?1:0;
        }
        if($delete!==null){
            $condition[$this->map->field()->Deleted]=$delete?1:0;
        }
        $query = $this->db->get_where($this->map->field,$condition);
        return $query->result_array();
    }
}